package lambda;

import java.util.function.Function;

/**
 * 数组引用
 * @author Summerday
 */
public class ArrayReferenceTest {

    public static void main(String[] args) {
        // 普通lambda
        Function<Integer,String[]> fun1 = x -> new String[x];
        String[] res1 = fun1.apply(10);
        System.out.println(res1.length);

        // 数组引用写法
        Function<Integer,String[]> fun2 = String[]::new;
        String[] res2 = fun2.apply(10);
        System.out.println(res2.length);

    }
}
